import { defineConfig } from 'vite'
import requireTransform from 'vite-plugin-require-transform';
import uni from '@dcloudio/vite-plugin-uni'
import vueJsx from '@vitejs/plugin-vue-jsx'
import AutoImport from 'unplugin-auto-import/vite'
import { resolve } from 'path'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    uni(),
    AutoImport({
      imports: [
        'vue',
        'pinia',
        'uni-app'
      ]
    }),
    vueJsx({
      // options are passed on to @vue/babel-plugin-jsx
    }),
    requireTransform({
      fileRegex: /.js$|.vue$/
    })
  ],
  resolve: {
    // 路径别名
    alias: {
      "@": resolve(__dirname, "./src"),
    },
  },
  envDir: "./env",
  envPrefix: "VITE_APP_",
})
